Release 10.1A: OpenEdge Development:
ProDataSets
Retrieving detail for the ProDataSet
Now you want to get the
OrderLinesfor a selectedOrder. You can do this by responding to a double-click on anOrderin the browse.
![]()
To get the
OrderLinesfor a selectedOrder:
- Define a trigger block
ON MOUSE-SELECT-DBLCLICKofOrderBrowse(this is one of the Portable Mouse Events).When the user selects an
Order, the trigger saves off theOrdernumber for later reference. It must then delete the temp-table row for thatOrder. For example:
Why is this? When you pass the request to the support procedure to fill in the detail, it is going to prepare the top-level
Orderquery for that one selectedOrder, set theFILL-MODEback to “APPEND” forOrderLinesandItems, and then do aFILL. ThatFILLwill read theOrderinto the top-level table along with itsOrderLinesand allItems. When this is returned to the client to be appended to the data already in the client’s ProDataSet, thatttOrderrow is going to be a duplicate of the row already there, and this will cause an error. Remember, when you use theOUTPUTAPPENDparameter form, new data in each temp-table is always appended to the rows already there. There is no ability to use theFILL-MODEto define a different behavior for each temp-table.Therefore, you must delete rows that will result in duplicates in advance, either on the sending side or the receiving side, before the new data is appended. In this case, deleting the existing row has the advantage of returning the latest field values for the
Orderalong with itsOrderLines, giving you what amounts to aREFRESHmode for theOrder. This, in general, is how you accomplish a refresh of data in a ProDataSet, simply by deleting the rows you want to refresh and then requesting them again.- In case the user has selected an
Orderthat has been selected before, you delete anyOrderLinesfor it so that they are refreshed as well. For example:
- You run another support procedure in
orderSupport.p, calledfetchOrderDetail, passing in the selectedOrderNumberand a flag telling the procedure whetherItemshave already been returned or not. If theItemsare already on the client they do not have to be refilled and passed from the server. The ProDataSet is received inAPPENDmode so that theOrderandOrderLinesthat come back are added to what’s already in the local ProDataSet, as shown:
- To reset the user interface, you need to open the top-level query, reposition the query to the selected
Order(which repositions the browse as well), and do aSYNCHRONIZEto reset the dependent queries forOrderLinesandItemsas well. For example:
- In
OrderSupport.p, thefetchOrderDetailprocedure empties the server-side ProDataSet and resets the selection to fill just the one selectedOrder. It resets theFILL-MODEfor thettOlinetable from “NO-FILL” to “APPEND” so thatOrderLinesare read for theOrder, and sets theFILL-MODEfor thettItemtable so thatItemsare filled the first time anOrderis selected, and then left out of the fill after that. For example:
With all this done, you can fully test the procedures.
- First make sure that your
dsOrder.iinclude file has theREPOSITIONkeyword for theLineItemrelation so that you can see all the items in thettItembrowse.- Run
PickOrder.w, select a set ofOrders using the filter fields, and then double-click on one of theOrders, as shown:
![]()
The first time you double-click on an
Order, itsOrderLinesand allItemsare brought over fromOrderSupport.p. After that, double-clicking on anotherOrderbrings over itsOrderLineswithout refetching theItems. If you simply select anOrderwithout double-clicking on it, this empties thettOlinebrowse, showing that itsOrderLinesare not yet part of the client’s ProDataSet.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |